/* * * * * * * * * * * * * * * * * * * * * *
*   Copyright (c) ycq_work@163.com
*   File:     testArray.cpp
*   Author:   ycq
*   e-mail：  ycq_work@163.com
*   Time:     2023-07-15
*   Description:
* * * * * * * * * * * * * * * * * * * * * * */

#include <iostream>

#include "../stl/MxgArray.h"

using namespace mxg::stl;

namespace testArray {

static void fun ()
{
    MxgArray<int> arr(10);
    MxgArray<int> xrr(1, 0, 8, 7);

    if(arr.empty ())
    {
        std::cout << "arr is empty !" << std::endl;
    }

    // std::cout << arr.front ();

    //std::cout<< '\n';

    for(int i = 0; i < 10; ++i)
    {
        arr.push_back (i);
        arr.push_back (1);
    }
    MxgArray<int> err(20);
    err = arr;

    for(int i = 0; i < err.size (); ++i)
    {
        std::cout << "err[" << i << "] = " << err[i] << " ";
    }
    std::cout << std::endl;
    std::cout << "err.max_size = " << err.max_size ();
    std::cout << '\n';
    err.pop_back ();
    err.pop_back ();
    err.pop_back ();


    for(int i = 0; i < err.size (); ++i)
    {
        std::cout << "err[" << i << "] = " << err[i] << " ";
    }
    std::cout << '\n';
    err.push_back (2);

    for(int i = 0; i < err.size (); ++i)
    {
        std::cout << "err[" << i << "] = " << err[i] << " ";
    }
    std::cout << '\n';

    std::cout << "err.front = " << err.front () << std::endl;

    std::cout << "err.back = "<< err.back () << std::endl;

    if(!xrr.empty())
    {
        std::cout << "xrr is not empty !" << std::endl;
    }

    for(int i = 0; i < xrr.size (); ++i)
    {
        std::cout << "xrr[" << i << "] = " << xrr[i] << " ";
    }

    std::cout << '\n';
}

}//namespace testArray
